﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Converters="clr-namespace:TTech.IP_Switcher.Converters">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Shared.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <Converters:BoolToActiveColorConverter x:Key="BoolToActiveColorConverter"/>

    <Style x:Key="ListBoxItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Margin" Value="1" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Foreground" Value="{StaticResource Foreground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Grid>
                        <Rectangle Fill="{TemplateBinding Background}" RadiusX="5" RadiusY="5" Stroke="transparent"/>
                        <ContentPresenter Margin="5"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Background" Value="{StaticResource BackgroundSelectedGradient}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{StaticResource BackgroundHighlighted}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBox" TargetType="{x:Type ListBox}" >
        <Setter Property="Background" Value="{StaticResource BackgroundNormal}"/>
        <Setter Property="ItemContainerStyle" Value="{DynamicResource ListBoxItem}" />
        <Setter Property="BorderBrush" Value="{StaticResource BorderBrushNormal}" />
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="true">
                        <ScrollViewer Focusable="false">
                            <ItemsPresenter SnapsToDevicePixels="True"/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value=".5"/>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>